<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>

    <p id="a" class="b">11</p>

    <p>22</p>

    <script>

        // 通过id获取标签   getElementById()   --- 单一的标签 
        // 通过类名获取标签  getElementsByClassName()   --- 伪数组
        // 通过标签名获取标签  getElementsByTagName()   --- 伪数组
        // ...

        // es6新增方法  
        //     querySelector()  单一的标签
        //     querySelectorAll()  伪数组


        var oP = document.getElementById('a');
        console.log(oP);

        var oP2 = document.getElementsByClassName('b');
        console.log(oP2);

        var oP3 = document.getElementsByTagName('p');
        console.log(oP3);


        var oP4 = document.querySelectorAll('.b');
        console.log(oP4);


        var oP5 = document.querySelector('p:nth-child(2)');
        console.log(oP5);

    </script>

</body>

</html>